import React, { Component } from 'react';
import ReactDom from 'react-dom';
import util from "@/common/util";
import turnplate from "@/common/turnplate";
import layer from "@/common/layer";
import Rate from '@/Components/rate';
import DDView from '@/Components/ddview';
import InlinePicker from '@/Components/inlinepicker';
import ReactSwiper from 'reactjs-swiper';
import axios from 'axios';
import { relative } from 'path';
import jquery from 'jquery';


class Rxproduct extends Component {
    constructor(props) {
        super(props);
        this.state = {
            productList: []
        }
    }

    componentDidMount() {
        this.getrxlist()
    }

    async getrxlist() {

        let res = await util.rjax({
            url: '/rxProduct/list',
            type: 'post'
        })
        this.setState({ productList: res.data });
    }

    render() {
        let productlist = this.state.productList.map((item, index) => {
            return (
                <li data-id={item.id} key={index}>
                    <a href={"./rxprodetail.html?id=" + item.id}>
                        <h4>{item.name}</h4>
                        <div>
                            <p>介绍：<span>{item.loan}</span></p>
                        </div>
                        <img className="prologo" src={item.image} alt="" />
                    </a>
                </li>
            )
        })
        return (
            <div>
                <div id="rxproduct">
                    <div className="prohead">
                        <img className="headimg" src="/assets/wechat/top_pic.png" alt="" />
                        <ul className="headul">
                            <li className="protitle">优</li>
                            <li className="protitle">质</li>
                            <li className="protitle">产</li>
                            <li className="protitle">品</li>
                        </ul>
                    </div>

                    <ul className="prolist">
                        {productlist}
                    </ul>
                </div>
            </div >
        )
    }
}
ReactDom.render(<Rxproduct />, document.getElementById("app"));